<template>
	<view class="spacenumber">
		<!-- #ifdef APP-PLUS -->
		<Hearder :name="'空间编号修改'"></Hearder>
		<!-- #endif -->
		<view class="content bgbottom">
			<view class="list">
				<view class="lable">空间名称:</view>
				<view class="right">
					<input placeholder="请输入空间名称" placeholder-style="color:#999;" v-model="space_name">
				</view>
			</view>
			<!-- <view class="list">
				<view class="lable">空间前缀:</view>
				<view class="right">
					<input placeholder="请输入空间前缀" placeholder-style="color:#999;" disabled v-model="detail.space_prefix">
				</view>
			</view> -->
			<view class="list">
				<view class="lable">空间编号:</view>
				<view class="right">
					<input placeholder="请输入空间编号" placeholder-style="color:#999;" disabled v-model="detail.space_no">
				</view>
			</view>
			<view class="list">
				<view class="lable">新编号:</view>
				<view class="right">
					<input type="number" placeholder="请输入新编号" placeholder-style="color:#999;" maxlength="6" v-model="xinspace_no">
				</view>
			</view>
		</view>
		<!-- <view class="tips-con">*只能输入数字编号，前缀无法修改</view> -->
		<view class="surebtn" @click="surexiugai">确定修改</view>
	</view>
</template>

<script>
	export default {
		data(){
			return{
				detail:{},
				xinspace_no:'',
				space_name:''
			}
		},
		onLoad() {
			this.request('/space/getSpaceConsole').then(res => {
				if(res.data.code==1){
					this.detail = res.data.data
					this.space_name = res.data.data.space_name
				}
			})
		},
		methods:{
			surexiugai(){
				this.request('/space/toSpace',{
					space_no:this.xinspace_no,
					space_id:this.detail.space_id,
					name:this.space_name
				}).then(res => {
					if(res.data.code==1){
						this.$tip(res.data.msg)
						setTimeout(()=>{
							uni.navigateBack()
						},500)
					}else{
						this.$tip(res.data.msg)
					}
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.spacenumber{
		.content{
			padding: 0 4%;
			.list{
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 40rpx 0;
				border-bottom: $uni-border-bottom;
				.lable{
					width: 25%;
				}
				.right{
					display: flex;
					justify-content: space-between;
					align-items: center;
					width: 75%;
					input{
						width: 100%;
						font-size: 30rpx;
					}
				}
			}
		}
		.tips-con{
			font-size: 24rpx;
			color: #999;
			margin: 20rpx 4% 50rpx;
		}
		.surebtn{
			background: $uni-item-color;
			text-align: center;
			line-height: 88rpx;
			height: 88rpx;
			color: #fff;
			margin: 40rpx 4%;
			font-size: 32rpx;
		}
	}
</style>